<?php 
use yii\helpers\Html;
use yii\widgets\LinkPager;
?>
<!--用户管理模块-->
<div class="check-div form-inline">
	<div class="col-xs-3">
		商家发布审核 
	</div>
</div>
<div class="data-div">
	<div class="row tableHeader">
		<div class="col-xs-3 ">
			职位名称
		</div>
		<div class="col-xs-3">
			发布时间
		</div>
		<div class="col-xs-2">
			薪资
		</div>
		<div class="col-xs-2">
			详细
		</div>
		<div class="col-xs-2">
			操作
		</div>
	</div>
	<div class="tablebody">
		<?php foreach ($data as $k => $row) {?>
		<div class="row show" show-id="<?=$row['id']?>">
			<div class="col-xs-3">
				<?=$row['pos_name']?>
			</div>
			<div class="col-xs-3">
			<?=date('Y-m-d H:i:s',$row['addtime'])?>
			</div>
			<div class="col-xs-2">
				<?=$row['pos_salary']?>
			</div>
			<div class="col-xs-2">
				<button type="button" class="btn btn-yellow btn-xs info" data-toggle="modal" data-target="#pos_introduce">点击查看</button>
			</div>
			<div style="display: none;">
				<?= $row['pos_introduce']?>
			</div>
			<div class="col-xs-2">
				<select pos_id="<?= $row['id']?>" class="state">
					<option value="0" <?php if($row['pos_state']==0) echo 'selected'?>>审核未通过</option>
					<option value="1" <?php if($row['pos_state']==1) echo 'selected'?>>审核已通过</option>
					<option value="2" <?php if($row['pos_state']==2) echo 'selected'?>>未审核</option>
				</select>
			</div>
		</div>
		<?php }?>
	</div>
	<script>
	$(function(){
		$('.info').click(function(){
			var content = $(this).parent().next().html();
			$('.show_intr').html(content)
			
		})
		$('.state').change(function(){
			var state = $(this).val()
			var id = $(this).attr('pos_id');
			var obj = $(this)
			$.ajax({
				url:'?w=position/state',
				data:{state:state,id:id},
				dataType:'json',
				success:function(data){
					if(!data.error){
						alert(data.msg)
					}
				}
			})
		})
	})
	</script>
</div>
<!--页码块-->
	<footer class="footer">
		<ul class="pagination">
			<li>
				<select id="page">
					<?php for ($i=1; $i <=$pagination->pageCount ; $i++) { 
						if ($i == $page) {
						echo "<option selected>".$page."</option>";
					}else{?>

						<option><?=$i?></option>
					<?php }} ?>
				</select>
				页
			</li>
			<li class="gray">
				共<?=$pagination->pageCount?>页
			</li>
			<?=LinkPager::widget(['pagination' =>$pagination])?>
		</ul>
	</footer>
	<script>
		$(function(){
			$("#page").change(function(){
				var page = $(this).val()
				location.href='?w=position%2Findex&page='+page;
			})
		})
	</script>

<div class="modal fade" id="pos_introduce" role="dialog" aria-labelledby="gridSystemModalLabel">
	<div class="modal-dialog" role="document">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
				<h4 class="modal-title" id="gridSystemModalLabel">职位介绍(要求)</h4><br>
				<span class="show_intr"></span>
			</div>
		</div>
		<!-- /.modal-content -->
	</div>
	<!-- /.modal-dialog -->
</div>